<template>
  <div class="container">
    <div class="Logo">
      <h2>心理健康指数只能管理系统</h2>
    </div>
    <div class="Login">
      <h3>登录</h3>
      <div class="box">
        <input type="text" placeholder="用户名" v-model="user.UserName" />
        <input type="Password" placeholder="密码" v-model="user.Password" />
        <br />
        <button class="addLogin" @click="addLogin">登录</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      user: {
        UserName: "",
        Password: ""
      }
    };
  },
  mounted() {},
  methods: {
    async addLogin(){
      try {
          const result = await this.$apis.login(this.user);
          alert('登陆成功')
          this.$router.push("/index");
      } catch (error) {
        console.log(error)
           alert(error)
      }
     
    }
  },
  computed: {},
  watch: {}
};
</script>

<style lang="scss" scoped>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.container {
  width: 100%;
  height: 100%;
  background: #049ec4;
  display: flex;
  justify-content: space-evenly;
}
.container .Logo h2 {
  color: white;
  font-size: 46px;
  position: fixed;
  left: 20%;
  top: 20%;
  font-weight: 500;
  letter-spacing: 5px;
}
.Login {
  width: 340px;
  height: 355px;
  position: relative;
  position: fixed;
  right: 10%;
  top: 10%;
  background-color: rgba(200, 200, 200, 0.6);
  h3 {
    padding: 0 15px;
    line-height: 45px;
    font-weight: 700;
    border-bottom: 1px solid #6696a2;
  }
}
.box input {
  width: 280px;
  height: 38px;
  border: none;
  margin: 15px 36px;
  border-radius: 3px;
  padding-left: 38px;
  outline: none;
}
.addLogin {
  width: 280px;
  height: 40px;
  background: #009688;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  margin: 15px 36px;
  color: white;
  border: none;
  outline: none;
  cursor: pointer;
}
</style>